package com.cskaoyan.market.admin.service.impl;

import com.cskaoyan.market.admin.service.AdminLogService;
import com.cskaoyan.market.db.domain.MarketLog;
import com.cskaoyan.market.db.domain.MarketLogExample;
import com.cskaoyan.market.db.mapper.MarketLogMapper;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AdminLogServiceImpl implements AdminLogService {
    @Autowired
    private MarketLogMapper mapper;

    @Override
    public List<MarketLog> list(Integer page, Integer limit, String sort, String order) {
        // 获取映射文件
        
        
        // 创建查询示例
        MarketLogExample marketLogExample = new MarketLogExample();
        // 设置排序
        marketLogExample.setOrderByClause(sort +" "+ order);
        // 分页 + 查询
        PageHelper.startPage(page, limit);
        List<MarketLog> marketLogs = mapper.selectByExample(marketLogExample);
        // 收尾
        
        return marketLogs;
    }
}
